﻿using ALMDDD.Domain.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;

namespace ALMDDD.Infrastructure.Mappings
{
    public class SysUserRoleMap : IEntityTypeConfiguration<SysUserRole>
    {
        public void Configure(EntityTypeBuilder<SysUserRole> builder)
        {
            builder.ToTable("sys_user_role");
            builder.HasKey(c => c.Id);
            builder.Property(c => c.Id)
                .HasColumnName("Id");
        
            builder.Property(c => c.RoleId)
                .HasColumnName("roleId");
            builder.Property(c => c.UserId)
                .HasColumnName("userId");
            //生成操作人姓名
            builder.Property(c => c.TrxName)
                 .HasColumnName("trxName")
                 .HasColumnType("varchar(20)");
            //操作时间
            builder.Property(c => c.TrxTime)
                .HasColumnName("trxTime")
                .HasColumnType("datetime");
            //操作人
            builder.Property(c => c.TrxUser)
                .HasColumnName("trxUser")
                .HasColumnType("varchar(20)");
        }
    }
}
